<%--
	fileName      : /ctpdemostd/WebContent/signin/force2changepwd.jsp
	author        : KFZX-LVSX
	createDate    : 2014-09-09  10:56:20
	lastModifier  : KFZX-LVSX
	lastModifyDate: 2014-09-09  10:56:20
	description   : 请添加描述
--%>

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="ctp-tag" prefix="ctp" %>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
		<title>Title</title>
		<ctp:include items="public,button" />
		<script type="text/javascript">
			var submitBtn;
			var resetBtn;
			var oldPassword;
			var password;
			var password2;
		</script>
		<script type="text/javascript">
			function initUI(){
				submitBtn = new ctp.ui.button({
					id: 'submitBtn',
					icon: 'apply',
					text: '<ctp:label key="submit_btn"/>',//提交
					renderTo: 'submitBtn_div',
					onClick: function(){
// 						oldPassword = document.getElementById("old_pw_obj").CrpytPwd('C:\\Windows\\System32\\ICBC_CTP_1_00000_3DES_16');
// 						password = document.getElementById("new_pw_obj").CrpytPwd('C:\\Windows\\System32\\ICBC_CTP_1_00000_3DES_16');
// 						password2 = document.getElementById("new_pw_obj2").CrpytPwd('C:\\Windows\\System32\\ICBC_CTP_1_00000_3DES_16');
						oldPassword = document.getElementById("old_pw_obj").value;
						password = document.getElementById("new_pw_obj").value;
						password2 = document.getElementById("new_pw_obj2").value;

						if(!oldPassword){
							alert('<ctp:label key="input_user_old_pwd"/>');//请输入用户旧密码！
							return;
						}
						if(oldPassword && !password){
							alert('<ctp:label key="input_user_new_pwd"/>');//请输入用户新密码！
							return;
						}
						if(oldPassword && password && !password2){
							alert('<ctp:label key="reinput_user_new_pwd"/>');//请输入用户新密码！
							return;
						}
						if(oldPassword && password && password2 && password !== password2){
							alert('<ctp:label key="two_pwd_not_match"/>');//两次输入的密码不一致！
							return;
						}

						var url = '<ctp:url href="changepassword.flowc" flowActionName="force2changepwd" />';
						var reqData = {
							"oldPassword": oldPassword,
							"password": password
						};
						var result = ctp.data.getJSON(url, reqData);
						if(result.out_flag === '0'){
							alert('<ctp:label key="modi_success"/>');
							parent.ctpMSB.close();
						}else if(result[0].out_flag === '2'){
							document.getElementById("old_pw_obj").value="";
							document.getElementById("old_pw_obj").focus();
							alert("旧密码输入错误,请重新输入");
						}else if(result[0].out_flag === '4'){
							document.getElementById("new_pw_obj").value="";
							document.getElementById("new_pw_obj2").value="";
							document.getElementById("new_pw_obj").focus();
							alert("新密码不能与旧密码相同,请重新输入");
						}else{
							alert(result[0].errorMsg);
						}
					}
				});
			}
		</script>
	</head>
	<body onload="initUI();">
		<div style="width:100%; ">
			<table style="padding-top:20px;width: 70%; margin: 0px auto;">
				<tbody style="padding:0px;margin:0px;width: 100%;">
					<tr style="width: 100%;">
						<td style="padding:0px;margin:0px;width: 100px; height: 32px;"><label class="ctp-fs ctp-ff ctp-cn"><ctp:label key="user.useroldPassword.label"/><span style="color:red;">*</span>:</label></td>
<%-- 						<td style="padding:0px;margin:0px;height: 32px;"><object id="old_pw_obj" width="100%" height="24" vspace="1" classid="CLSID:fc0bff2d-47a5-0846-0147-a5084e8b000e" codebase='<ctp:out name="fullPath"/>WEB-INF/config/contributions/common/CTPCryptoControl.CAB#version=1,0,0,00'></object></td> --%>
						<td style="padding:0px;margin:0px;height: 32px;"><input id="old_pw_obj" type = "password" width="100%" height="24" vspace="1"></input></td>
					</tr>
					<tr style="width: 100%;">
						<td style="padding:0px;margin:0px;width: 100px; height: 32px;"><label class="ctp-fs ctp-ff ctp-cn"><ctp:label key="user.userPassword.label"/><span style="color:red;">*</span>:</label></td>
<%-- 						<td style="padding:0px;margin:0px;height: 32px;"><object id="new_pw_obj" width="100%" height="24" vspace="1" classid="CLSID:fc0bff2d-47a5-0846-0147-a5084e8b000e" codebase='<ctp:out name="fullPath"/>WEB-INF/config/contributions/common/CTPCryptoControl.CAB#version=1,0,0,00'></object></td> --%>
						<td style="padding:0px;margin:0px;height: 32px;"><input id="new_pw_obj" type = "password" width="100%" height="24" vspace="1" ></input></td>
					</tr>
					<tr style="width: 100%;">
						<td style="padding:0px;margin:0px;width: 100px; height: 32px;"><label class="ctp-fs ctp-ff ctp-cn"><ctp:label key="user.userPassword2.label"/><span style="color:red;">*</span>:</label></td>
<%-- 						<td style="padding:0px;margin:0px;height: 32px;"><object id="new_pw_obj2" width="100%" height="24" vspace="1" classid="CLSID:fc0bff2d-47a5-0846-0147-a5084e8b000e" codebase='<ctp:out name="fullPath"/>WEB-INF/config/contributions/common/CTPCryptoControl.CAB#version=1,0,0,00'></object></td> --%>
						<td style="padding:0px;margin:0px;height: 32px;"><input id="new_pw_obj2" type = "password" width="100%" height="24" vspace="1" ></input></td>
					</tr>
					<tr>
						<td colspan="2" align="center">
							<table style="padding-top: 20px;">
								<tr>
									<td>
										<div id="submitBtn_div"></div>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</tbody>
			</table>
		</div>
	</body>
</html>

<%--
	date        :
	modifyReason:
--%>